package com.hzw.saas.web.app.user.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hzw.saas.common.util.AccountValidatorUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * 用户注册参数
 *
 * @author zzl
 * @since 12/25/2020
 */
@Data
@ApiModel(value = "用户注册")
public class UserRegisterParam {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Length(min = 2, max = 50)
    @ApiModelProperty(value = "用户名", position = 2, required = true)
    private String userName;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @ApiModelProperty(value = "密码", position = 3, required = true)
    private String password;

    /**
     * 真实姓名
     */
    @NotBlank(message = "真实姓名不能为空")
    @Pattern(regexp = AccountValidatorUtil.REGEX_LONG_CHINESE_NAME_OR_BLANK, message = "姓名格式不正确")
    @ApiModelProperty(value = "真实姓名", position = 3, required = true)
    private String realName;

    /**
     * 电话号码
     */
    @Pattern(regexp = AccountValidatorUtil.REGEX_MOBILE_OR_BLANK, message = "手机号码格式不正确")
    @ApiModelProperty(value = "手机号码", position = 4)
    private String phoneNo;

    /**
     * 邮箱地址
     */
    @Pattern(regexp = AccountValidatorUtil.REGEX_EMAIL_OR_BLANK, message = "邮箱格式不正确")
    @ApiModelProperty(value = "邮箱地址", position = 5)
    private String email;

    /**
     * 注册日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "注册日期", position = 7, hidden = true)
    private Date registeredDate;

    @NotBlank(message = "验证码不能为空")
    @ApiModelProperty(value = "验证码", position = 8, required = true)
    private String verifyCode;

    @ApiModelProperty(value = "注册渠道",notes = "渠道类型，A-用户注册/销售手机号，B-后台开通/销售id，C-销售在线推广/销售id，D-单机软件/产品id，E-线上促销推广/活动id，F-线下活动扫码/活动id", position = 9)
    private String channelType;

    @ApiModelProperty(value = "渠道ID", notes = "销售ID或者销售手机号码或者任意字符串", position = 9)
    private String channelId;

    @ApiModelProperty(value = "渠道描述", notes = "渠道描述", position = 9)
    private String channelDesc;

    @ApiModelProperty(value = "地区(省/市)", position = 10)
    private String region;

    @ApiModelProperty(value = "详细地址", position = 11)
    private String address;

    @ApiModelProperty(value = "机构(学校/企业)", position = 12)
    private String organ;

    @ApiModelProperty(value = "院系/部门", position = 13)
    private String department;

    @ApiModelProperty(value = "发票信息", position = 14)
    private String invoice;

    @ApiModelProperty(value = "openId,三方注册专用如微信扫码注册，非三方传空,",position = 15)
    private String openId;

    @ApiModelProperty(value = "unionId,三方注册专用如微信扫码注册，非三方传空",position = 16)
    private String unionId;
}
